package com.song.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.song.dao.NetClassDao;
import com.song.po.NetClass;
import com.song.service.NetClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NetClassServiceImpl implements NetClassService {
   @Autowired
   private NetClassDao netClassDao;

   @Override
   public List<NetClass> getAllClassList() {
      List<NetClass> list = netClassDao.selectList(null);
      return list;
   }

   @Override
   public List<NetClass> getClassByWrapper(NetClass netClass) {
      QueryWrapper<NetClass> queryWrapper = new QueryWrapper<>();
      if(netClass.getNetClassName() != null && !(netClass.getNetClassName() .equals(""))){
         queryWrapper.like("netClass_name",netClass.getNetClassName());
      }
      if(netClass.getTeacherName() != null && !(netClass.getTeacherName() .equals(""))){
         queryWrapper.like("teacher_name",netClass.getTeacherName());
      }
      List<NetClass> list = netClassDao.selectList(queryWrapper);
      return list;
   }
}
